]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Change 'debugexit' to quit main loop rather than exit(), add cleanup
authorColin Walters <walters@verbum.org>
Thu, 5 May 2011 22:09:59 +0000 (18:09 -0400)
committerColin Walters <walters@verbum.org>
Thu, 19 May 2011 19:35:04 +0000 (15:35 -0400)
A new envrionment variable GNOME_SHELL_ENABLE_CLEANUP is added which
causes us to attempt freeing global data.  The reason this isn't
enabled by default is that it's a waste of time at best, and at
worst in corner cases could cause crashes which would fill up
crash databases.  Better to leave it as a developer-only tool.

Start stubbing out some cleanup in ShellGlobal.

https://bugzilla.gnome.org/show_bug.cgi?id=649517

js/ui/runDialog.js
src/main.c
src/shell-global.c

index 3114bd8243c0813b3e52e1ff29e8d9218afa2d7c..192a93ae740fcd2ebf6c441dd89d4983d0ad0a07 100644 (file)
@@ -189,7 +189,7 @@ __proto__: ModalDialog.ModalDialog.prototype,
                                    }),
 
                                    'debugexit': Lang.bind(this, function() {
-                                       Meta.exit(Meta.ExitCode.ERROR);
+                                       Meta.quit(Meta.ExitCode.ERROR);
                                    }),
 
                                    // rt is short for "reload theme"
index c9c9d6e12339cd23532bd5ab5eaf31abdb485e86..0e7718719332a50934b76048932dab20b452a419 100644 (file)
@@ -453,6 +453,7 @@ main (int argc, char **argv)
 {
   GOptionContext *ctx;
   GError *error = NULL;
+  int ecode;
 
   g_type_init ();
 
@@ -507,5 +508,13 @@ main (int argc, char **argv)
   /* Initialize the global object */
   shell_global_get ();
 
-  return meta_run ();
+  ecode = meta_run ();
+
+  if (g_getenv ("GNOME_SHELL_ENABLE_CLEANUP"))
+    {
+      g_printerr ("Doing final cleanup...\n");
+      g_object_unref (shell_global_get ());
+    }
+
+  return ecode;
 }
index 9cb2c50786c3b2238d048ee60096aa9769f79898..e18dbc998d457e01992fce4baf30520c00721db3 100644 (file)
@@ -34,6 +34,8 @@
 #include "shell-wm.h"
 #include "st.h"
 
+static ShellGlobal *the_object = NULL;
+
 static void grab_notify (GtkWidget *widget, gboolean is_grab, gpointer user_data);
 
 struct _ShellGlobal {
@@ -254,6 +256,20 @@ shell_global_init (ShellGlobal *global)
   g_strfreev (search_path);
 }
 
+static void
+shell_global_finalize (GObject *object)
+{
+  ShellGlobal *global = SHELL_GLOBAL (object);
+
+  g_object_unref (global->js_context);
+  gtk_widget_destroy (GTK_WIDGET (global->grab_notifier));
+  g_object_unref (global->settings);
+
+  the_object = NULL;
+
+  G_OBJECT_CLASS(shell_global_parent_class)->finalize (object);
+}
+
 static void
 shell_global_class_init (ShellGlobalClass *klass)
 {
@@ -261,6 +277,7 @@ shell_global_class_init (ShellGlobalClass *klass)
 
   gobject_class->get_property = shell_global_get_property;
   gobject_class->set_property = shell_global_set_property;
+  gobject_class->finalize = shell_global_finalize;
 
   /* Emitted from gnome-shell-plugin.c during event handling */
   shell_global_signals[XDND_POSITION_CHANGED] =
@@ -424,8 +441,6 @@ shell_global_class_init (ShellGlobalClass *klass)
 ShellGlobal *
 shell_global_get (void)
 {
-  static ShellGlobal *the_object = NULL;
-
   if (!the_object)
     the_object = g_object_new (SHELL_TYPE_GLOBAL, 0);